package com.example.aerospacemanagementsystem.controller.attendance;

import com.example.aerospacemanagementsystem.entity.attendance.Attendance;

import com.example.aerospacemanagementsystem.service.attendanceService.AttendanceService;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 李明国
 */
@Api(tags = "出勤")
@RestController
@CrossOrigin
@RequestMapping("/attendance")
public class AttendanceController {
    @Autowired
    private AttendanceService attendanceService;
    //添加出勤
    @PostMapping
    public int add(@RequestBody Attendance attendance){
        return attendanceService.add(attendance);
    }
    //删除出勤
    @DeleteMapping
    public int delete(Attendance attendance){
        return attendanceService.delete(attendance);
    }
    //修改出勤
    @PutMapping
    public int update(@RequestBody Attendance attendance){
        return attendanceService.update(attendance);
    }
    //获取出勤
    @GetMapping("/getAll")
    public List<Attendance> getAllCity(Attendance attendance) {
        List<Attendance> list = attendanceService.getAllAttendance(attendance);
        return list;
    }
}
